package Classes.Managers// ActionScript file
{
	import Classes.GameErrors.GameError;
	import Classes.GameUtils.GU_DataTransform;
	
	import flash.events.Event;
	import flash.net.URLLoader;
	import flash.net.URLRequest;

	public class M_Languages extends Manager
	{
		private static var _instance:M_Languages;/*静态引用*/
		private var _languageObj:Object;/*语言包存储器*/
		private var _languageStr:String;/*当前语言*/
		public function M_Languages():void
		{
//			_instance=this;
//			this.init();
		}
		
//		private function init():void
//		{
//			this._languageObj=new Object;
//		}
//		
//		override public function importData():void
//		{
//			this._languageStr=this.main.mainXML.languageStr;
////			if(this.languageStr=="SimplifiedChinese")
////			{
////				this.importOver();
////				return;
////			}
//			var languagePackagePath:String=this.main.mainXML.languagePackagePath;
//			var loader:URLLoader=new URLLoader;
//			var request:URLRequest=new URLRequest(languagePackagePath+this.languageStr+".csv"+ZombieTown.instance.pageParams);
//			loader.addEventListener(Event.COMPLETE,loadOverHandler);
//			loader.load(request);
//		}
//		
//		private function loadOverHandler(e:Event):void
//		{
//			(e.target as URLLoader).removeEventListener(Event.COMPLETE,loadOverHandler);
//			var loaderStr:String=String((e.target as URLLoader).data);
//			var languageAry:Array=GU_DataTransform.csvTransformObjsAry(loaderStr,2);
//			for each(var transformObj:Object in languageAry)
//			{
//				this.languageObj[String(transformObj.source)]=String(transformObj.transform);
//			}
//			this.importOver();
//		}
		
		/**
		 *获得翻译后的文字 
		 * @param chineseStr
		 * @return 
		 * 
		 */		
//		public static function getStr(simplifiedChineseStr:String):String
//		{
////			if(instance.languageStr=="SimplifiedChinese")return simplifiedChineseStr
//			if(!instance.languageObj.hasOwnProperty(simplifiedChineseStr))throw new GameError("该文字还没有翻译");
//			return String(instance.languageObj[simplifiedChineseStr]);
//		}

		/*getter & setter*/
//		public static function get instance():M_Languages
//		{
//			return _instance;
//		}
//
//		public function get languageObj():Object
//		{
//			return _languageObj;
//		}
//
//		public function get languageStr():String
//		{
//			return _languageStr;
//		}


	}
}